/** 查询定时任务列表 */
export function listJobApi(query: JobRecord): Promise<ApiRowsRecord<JobRecord[]>> {
  return request({
    url: `monitor/job/list`,
    method: 'get',
    params: query
  });
}

/** 查询定时任务详细 */
export function getJobApi(id: number): Promise<ApiDataRecord<JobRecord>> {
  return request({
    url: `monitor/job/${id}`,
    method: 'get'
  });
}

/** 新增定时任务 */
export function addJobApi(data: JobRecord): Promise<ApiRecord> {
  return request({
    url: "monitor/job",
    method: 'post',
    data: data
  });
}

/** 修改定时任务 */
export function updateJobApi(data: JobRecord): Promise<ApiRecord> {
  return request({
    url: "monitor/job",
    method: 'put',
    data: data
  });
}

/** 删除定时任务 */
export function delJobApi(id: number[]): Promise<ApiRecord> {
  return request({
    url: `monitor/job/${id}`,
    method: 'delete',
  });
}


/** 定时任务立即执行一次 */
export function runJobApi(data: JobRecord): Promise<ApiRecord> {
  return request({
    url: '/monitor/job/run',
    method: 'put',
    data: data
  })
}


// 清空调度日志
export function cleanJobLogApi(): Promise<ApiRecord> {
  return request({
    url: '/monitor/jobLog/clean',
    method: 'delete'
  })
}
